<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test</title>
    <!-- Vue.js v2.6.12 -->
    <script src="/vue.js"></script> 
</head>
<body>
    <section id="app">
        <a href="#" @click.prevent="comName=login">登录</a>
        <a href="#" @click.prevent="comName=register">注册</a>
        <component v-bind:is="comName"></component>
    </section>
    <script>
        Vue.component('login', {
            template: '<div>{{msg}}</div>',
            data: function(){
                return {
                    msg: '登录页面'
                }
            }
        });
        Vue.component('register', {
            template: '<div>{{msg}}</div>',
            data: function(){
                return {
                    msg: '注册页面'
                }
            }
        });
        let vm = new Vue({
            el: '#app',
            data: {
                comName: ''
            }
        });
    </script>
</body>
</html>